import { GetAnnounceData } from "@/network/announce/model";
import { GetAnnounce } from "@/network/announce/service";
import { Component } from "react";
import { Props, State } from "./model";
export default class Service extends Component<Props,State>{
    state: Readonly<State>={
        noticeList:[],
        policyFileList:[]
    };


    getAnnounce=async (type:number)=>{
        const currentArea=JSON.parse(localStorage.getItem("currentArea") as string);
        return GetAnnounce({
            type:type,
            areaId:currentArea?.key,
            page:1,
            limit:100000,
            keyWord:""
        })
    }

    setNotice=async ()=>{
        const data=await this.getAnnounce(1);
        this.setState({
            noticeList:data  as GetAnnounceData
        })
    }
    setPolicyFile=async()=>{
        const data=await this.getAnnounce(2);
        this.setState({
            policyFileList:data  as GetAnnounceData
        })
    }

    componentWillMount(){
        this.setNotice();
        this.setPolicyFile();
    }

 

}